<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Administration</title>
        <?
        require_once("../config.php");
        ?>
        <script type="text/javascript" src="./lib/jquery-1.7.2.min.js"></script>
        <script type="text/javascript">
            
            function addThisRank()
            {
                var rank = new Array();
                rank["name"] = $('#name').val();
                rank["_oid"] = $('#_oid').val();
                rank["_rid"] = $('#_rid').val();
                var result = addRank(rank);
                alert(result);
                loadTabContent('./view/admin.rank.overview.php','');
            }

        </script>
    </head>
    <body>
        <form action="" id="characterForm" method="post">
            <table border="0" class="admin">
                <thead>
                <th colspan="2">Rang anlegen</th>
                </thead>
                <tr>
                    <td>Name:</td>
                    <td><input type="text" id="name" value="" /></td>
                </tr>
                <tr>
                    <td>An Organisation binden:</td>
                    <td><select id="_oid">
                            <option value="NULL">nicht binden</option>
                            <?
                            $sql = "SELECT * FROM `organisation`";
                            $result = MySql::query($sql);
                            while ($row = mysql_fetch_object($result)) {
                                echo "<option value=" . $row->_id . ">" . htmlentities($row->name, ENT_QUOTES, 'UTF-8') . "</option>";
                            }
                            ?>
                        </select></td>
                </tr>
                <tr>
                    <tr>
                    <td>Vorgesetzter Rang</td>
                    <td><select id="_rid">
                            <option value="" selected="selected">kein Vorgesetzter Rang</option>
                            <?
                            $sql = "SELECT * FROM `rank`";
                            $result = MySql::query($sql);
                            while ($row = mysql_fetch_object($result)) {
                                echo "<option value=" . $row->_id . ">" . htmlentities($row->name, ENT_QUOTES, 'UTF-8') . "</option>";
                            }
                            ?>
                        </select></td>
                </tr>
                <tr>
                    <td><input type="button" onclick="addThisRank()" value="Speichern"></td>
                </tr>
            </table>
        </form>
    </body>
</html>
